<?php


namespace App\Controller\Admin;


use App\Controller\AbstractController;
use App\Request\Admin\AdminMenuRequest;
use App\Service\Admin\AdminMenuService;
use Hyperf\Di\Annotation\Inject;

class AdminMenuController extends AbstractController
{

    /**
     * @Inject()
     * @var AdminMenuService
     */
    protected $adminMenuService;

    public function save($id, AdminMenuRequest $request)
    {
        $validated = $request->validated();

        $this->adminMenuService->save($id, $validated);

        return $this->response->success();
    }

    public function tree()
    {
        $tree = $this->adminMenuService->tree();
        return $this->response->success($tree);
    }

}